local wanlan = fk.CreateSkill{
  name = "wk_heg__wanlan",
  tags = {Skill.DeputyPlace},
}

Fk:loadTranslationTable{
  ["wk_heg__wanlan"] = "挽澜",
  [":wk_heg__wanlan"] = "副将技，其他角色进入濒死状态时，你可弃置所有手牌，令其回复体力至1点，然后你交换主副将。",

  ["$wk_heg__wanlan1"] = "石亭既败，断不可再失大司马！",
  ["$wk_heg__wanlan2"] = "大司马怀托孤之重，岂容半点有失？",
}

local HG = require "packages.new_heg_diy_my.util"

wanlan:addEffect(fk.EnterDying, {
  anim_type = "drawcard",
  events = {fk.EnterDying},
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self) and player ~= target and player:getHandcardNum() > 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:throwAllCards("h", wanlan.name)
    room:recover({
      who = target,
      num = 1 - target.hp,
      recoverBy = player,
      skillName = wanlan.name,
    })
    HG.SwapMainAndDeputy(room, player)
  end,
})

return wanlan